﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;

namespace ZG_member
{
    public partial class Speak : Form
    {
        public Speak()
        {
            InitializeComponent();
            skinEngine1.SkinFile = Application.StartupPath + ConfigurationManager.AppSettings["Skin"];
            this.Opacity = 0;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Left += 2;
            this.Opacity += 0.1;
            if (Opacity == 1)
            {
                this.timer1.Stop();

            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            this.Top = this.Top + 10;
            this.Opacity = this.Opacity - 0.06;
            if (Opacity <= 0)
            {
                this.timer2.Stop();
                this.Close();
            }
        }
        int flag = 0;
        private void Speak_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (flag == 0)
            {
                e.Cancel = true;
                flag = 1;
                this.timer2.Start();
            }
        }

        private void Speak_Load(object sender, EventArgs e)
        {
            this.timer1.Start();
            ZG_member.BLL.Speak speak = new ZG_member.BLL.Speak();
            ZG_member.Model.Speak speakMode = new ZG_member.Model.Speak();
            DataTable dt= speak.GetListWhere("").Tables[0];
            this.textBox1.Text = dt.Rows[0]["Contents"].ToString();
            this.textBox2.Text = dt.Rows[1]["Contents"].ToString();
            this.textBox3.Text = dt.Rows[2]["Contents"].ToString();
            this.textBox4.Text = dt.Rows[3]["Contents"].ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            #region 创建对象
            ZG_member.BLL.Speak speak = new ZG_member.BLL.Speak();
            ZG_member.Model.Speak speakMode = new ZG_member.Model.Speak();
            #endregion
            speak.Update("生日", this.textBox1.Text);
            speak.Update("快到期会员", this.textBox2.Text);
            speak.Update("长期未练习", this.textBox3.Text);
            speak.Update("停卡到期", this.textBox4.Text);
            MessageBox.Show("修改成功！");
            this.Close();
        }
    }
}
